# -*- coding: utf-8 -*-
from sqlalchemy import create_engine, text
URL = "postgresql+psycopg://verimake:verinew@127.0.0.1:5432/metrics"
engine = create_engine(URL, future=True, pool_pre_ping=True)

try:
    with engine.connect() as conn:
        v = conn.execute(text("SELECT version()")).scalar_one()
        n = conn.execute(text("SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='public'")).scalar_one()
        print("OK,", v, "tables:", n)
except Exception as e:
    print("FAILED:", e)
